<template>
  <div>
    Home
    <el-button type="primary" @click="logout">注销</el-button>
  </div>
</template>
<script>
export default {
  methods: {
    logout() {
      this.$confirm("是否退出登录?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          window.sessionStorage.clear();
          this.$message({
            type: "success",
            message: "退出成功!"
          });
          this.$router.push("/login");
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消退出！"
          });
        });
    }
  }
};
</script>
<style lang="less" scoped>
</style>